﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Cache.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    public sealed class RedisConfiguration
    {
        internal const string ELEMENT_NAME = "redis";
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("host")]
        public string Host
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("port")]
        public ushort Port
        {
            get;
            set;
        } = 6379;
        /// <summary>
        /// 
        /// </summary>
        public string FullHost
        {
            get
            {
                var host = string.IsNullOrWhiteSpace(this.Host) ? "localhost" : this.Host;
                return $"{host}:{Port}";
            }
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("database")]
        public int Database
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("password")]
        public string Password
        {
            get;
            set;
        }
    }
}
